import { defineStore } from "pinia";
import { getToken, setToken, removeToken } from "@/utils/auth";
export const loginStore = defineStore("login", {
  state: () => {
    return {
      token: getToken(),
      userInfo: {
        auth: sessionStorage.getItem('auth'),
      },
    };
  },
  getters: {},
  actions: {
    setToken(data) {
      setToken(data);
      this.token = data;
    },
    changeUserInfo(info) {
      this.userInfo = info;
    },
    RemoveToken() {
      this.token = "";
      removeToken();
      sessionStorage.clear();
    },
  },
});
